﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Amoo.WebControls
{
    public partial class CadastrarUsuario : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnGravar_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
                return;
            
            if (Code.Common.Util.Form.ValidateWebForm(pnlDadosCadastroUsuario) != null)
                return;

            Code.Entity.Usuario usuario = new Amoo.Code.Entity.Usuario()
            {
                dsNome = txtUsuario.Text,
                dsEmail = txtEmail.Text,
                dsSenha = txtSenha.Text
            };
            (new Code.Business.Usuario()).Insert(usuario);
            Code.Common.Util.Form.ClearWebForm(pnlDadosCadastroUsuario);
        }

        private bool ValidateForm()
        {
            return true;
        }
    }
}